const connect = require('connect');
const getRawBody = require('raw-body');
const bodyParser = require('body-parser');

connect().use(limit).use(bodyParser()).use(hello).listen(3000);

function limit(req, res, next) {
  getRawBody(req, { limit: '32kb' }, function (err) {
    if (err) {
      return next(err);
    } else {
      next();
    }
  });
}

function hello(req, res) {
  res.end('hello\n');
}
